﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MMCP
{
    public class TermHierarchyData
    {
        public string Path { get { return GetPath(); } }
        public string DisplayName { get; set; }
        public string HierarchyID { get; set; }
        public TermHierarchyData ParentNode { get; set; }
        public bool HasChilds { get; set; }

        private string GetPath()
        {
            string ret = string.Empty;
            List<TermHierarchyData> set = new List<TermHierarchyData>();
            var t = this;
            while (t != null)
            {
                set.Add(t);
                t = t.ParentNode;
            }
            set.Reverse();
            foreach (var item in set)
                ret += string.Format("{0}.", item.DisplayName);
            return ret.TrimEnd('.');
        }
    }
}
